﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data.OleDb;
using DAL.ModelView;
using BLL;
using DAL;

namespace QuanLyPhongKham
{
    public partial class FrmLogin : Form
    {
        public FrmLogin()
        {
            InitializeComponent();
        }

        private void btnlogin_Click(object sender, EventArgs e)
        {  
            NhanVien nv = new NhanVien();
            nv.manv = txtuser.Text;
            nv.pass = txtpass.Text;
            NhanVienBLL nvLL = new NhanVienBLL();
            NhanVienView result=nvLL.Login(nv);
            if (result.Manv==null)
            {
                MessageBox.Show("Đăng nhập không thành công!", "Thông báo");
            }else
            {
                this.Hide();
                FrmChinh Chinh = new FrmChinh();
                Chinh.ShowDialog();
                this.Close();
            }
        }

        private void btnexit_Click(object sender, EventArgs e)
        {
            DialogResult traloi;
            traloi = MessageBox.Show("Bạn có muốn thoát Không?", "Thông Báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            if (traloi == DialogResult.OK)
                Application.Exit();
        }

        private void FrmLogin_Load(object sender, EventArgs e)
        {

        }
    }
}
